<script setup lang="ts">
// 异步加载components下的asyncOne.vue，注意是异步

import asyncOne from "@/pages/async/components/asyncOne.vue";

// const asyncOne = defineAsyncComponent(
//   () => import("./components/asyncOne.vue"),
// );
const asyncTwo = defineAsyncComponent(
  () => import("./components/asyncTwo.vue"),
);

const flag = ref(2);
</script>

<template>
  <div>
    <a-button @click="flag = flag == 1 ? 2 : 1">{{ flag }}</a-button>
  </div>
  <async-one v-if="flag == 1" />
  <async-two v-if="flag == 2" />
</template>

<style scoped></style>
